package com.xiaoshuidi.cloud.module.contract.enums.contract;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 收款周期的枚举值
 */
@Getter
@AllArgsConstructor
public enum ContractPaymenEnum {
    OTHER_PAYMENT(0, "其他", "其他"),
    MONTHLY_PAYMENT(1, "月付", "月度"),
    QUARTERLY_PAYMENT(3,"季付", "季度"),
    HALF_YEAR_PAYMENT(6,"半年付", "半年度"),
    YEAR_PAYMENT(12,"年付", "年度"),
    ;

    private Integer code;
    private String msg;
    private String fillMsg;

    public static String getName(Integer code) {
        for (ContractPaymenEnum c : ContractPaymenEnum.values()) {
            if (c.getCode().intValue() == code.intValue()) {
                return c.msg;
            }
        }
        return OTHER_PAYMENT.getMsg();
    }

    public static String getFillName(Integer code) {
        for (ContractPaymenEnum c : ContractPaymenEnum.values()) {
            if (c.getCode().intValue() == code.intValue()) {
                return c.fillMsg;
            }
        }
        return OTHER_PAYMENT.getFillMsg();
    }
}
